<template>
  <div class="mod-order">
    <el-form :model="searchForm" @keyup.enter.native="getDataList()">
      <el-form-item label>
        <el-input v-model="searchForm.orderCode" placeholder="订单编号"></el-input>
      </el-form-item>
    </el-form>
    <el-table
      :data="dataList"
      border
      @selection-change="selectionChangeHandle"
      style="width: 100%;"
    >
      <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
      <el-table-column prop="orderCode" header-align="center" align="center" label="订单编号"></el-table-column>
      <el-table-column prop="domainName" header-align="center" align="center" label="域名"></el-table-column>
      <el-table-column prop="prodSource" header-align="center" align="center" label="产品"></el-table-column>
      <el-table-column prop="authType" header-align="center" align="center" label="验证类型"></el-table-column>
      <el-table-column prop="createTime" :formatter="dateForma" header-align="center" align="center" label="创建时间" >
      </el-table-column>
    </el-table>
  </div>
</template>
<script>

export default {
  data () {
    return {
      searchForm: {
        orderCode: ''
      },
      dataList: [],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListSelections: [],
      addOrUpdateVisible: false
    }
  },
  activated () {
    this.getDataList()
  },
  methods: {
    getDataList () {
      this.$http({
        url: '/acme/order/list',
        method: 'get',
        params: {
          page: this.pageIndex,
          limit: this.pageSize,
          'orderCode': this.searchForm.orderCode
        }
      }).then(({ data }) => {
        if (data && data.code === 0) {
          this.dataList = data.page.records
          this.totalPage = data.page.total
        } else {
          this.dataList = []
          this.totalPage = 0
        }
      })
    },
    // 每页数
    sizeChangeHandle (val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle (val) {
      this.pageIndex = val
      this.getDataList()
    },
    // 多选
    selectionChangeHandle (val) {
      this.dataListSelections = val
    },
    // 查看详情
    showDetails (id) {
      this.addOrUpdateVisible = true
      this.$nextTick(() => {
        this.$refs.addOrUpdate.init(id, true)
      })
    }
  }
}
</script>
